const userMod = require('../model/userMod.js')
const {enCode} = require('../utils/enCode.js')
// 该层处理数据库参数
const userServ = {
  getContactServ:async (userId) => {
    const res = await userMod.getContactMod(userId)
    return res[0]
  },
  sendFeedbackServ:async (params) => {
    await userMod.sendFeedbackMod(params)
  },
  isExistServ: async (data) => {
    let uid = await enCode(data.code) // 解析code为uid
    data.uid = uid
    await userMod.isExistMod(data) // 操作数据库 查看是否存在用户
    return uid
  },
  editResumeServ: async (params) => {
    await userMod.editResumeMod(params) // 查数据库
  },
  // updateBaseinfoServ: async (params) => {
  //   await userMod.updateBaseinfoMod(params) // 查数据库
  // },
  getUserinfoServ: async (uid) => {
    let data = await userMod.getUserinfoMod(uid) // 查数据库
    return data[0]
  }
}

module.exports = userServ